import unittest

from pygo1963.model.Constants import WHITE_COLOR, BLACK_COLOR 
from pygo1963.model.Move import Move, InvalidColorError
from pygo1963.model.Vertex import Vertex


class MoveTest(unittest.TestCase):

    def test_valid_move(self):
        move = Move("White", Vertex.from_string("a2"))        
        self.assertEquals(move.color, WHITE_COLOR)
        
        move = Move("w", Vertex.from_string("a2"))
        self.assertEquals(move.color, WHITE_COLOR)
        
        move = Move("Black", Vertex.from_string("a2"))        
        self.assertEquals(move.color, BLACK_COLOR)
        
        move = Move("b", Vertex.from_string("a2"))        
        self.assertEquals(move.color, BLACK_COLOR)
    
    def test_invalid_move(self):
        self.assertRaises(InvalidColorError, Move, "wasa", Vertex.from_string("a1"))
        self.assertRaises(InvalidColorError, Move, "blue", Vertex.from_string("a1"))


if __name__ == "__main__":
    unittest.main()